import { createRouter, createWebHistory } from "vue-router";
import LoginView from "../views/LoginView.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/home",
      meta: {
        isShowBar: true,
      },
    },
    {
      meta: {
        isShowBar: true,
      },
      path: "/home",
      name: "home",
      component: () => import("../views/HomeView.vue"),
    },
    {
      meta: {
        isShowBar: true,
      },
      path: "/item",
      name: "item",
      component: () => import("../views/ItemView.vue"),
    },
    {
      meta: {
        isShowBar: true,
      },
      path: "/detail/:id",
      name: "detail",
      component: () => import("../views/DetailsView.vue"),
    },
    {
      meta: {
        isShowBar: true,
      },
      path: "/cart",
      name: "cart",
      component: () => import("../views/CartView.vue"),
    },
    {
      meta: {
        isShowBar: true,
      },
      path: "/my",
      name: "my",
      component: () => import("../views/MineView.vue"),
      // children:[
      //   {
      //     path:'infor',
      //     name:'information',
      //     component:() => import('../components/mine/information/infor.vue')
      //   }
      // ]
    },
    {
      meta: {
        isShowBar: false,
      },
      path: "/my/infor",
      name: "infor",
      component: () => import("../components/mine/information/infor.vue"),
    },
    {
      meta: {
        isShowBar: false,
      },
      path: "/login",
      name: "login",
      component: () => import("../views/LoginView.vue"),
    },
  ],
});

export default router;
